/**
 * @Author：ming
 * @Date：2023/10/2 2:40 AM
 * @Filename：Lc71
 */

/**
 * @author ming
 */
public class Lc71 {
    public String simplifyPath(String path) {

        //替换.或者..
        String s = path.replaceAll("[.]{1,}", "/");

        // 多个//变成1个

        String s1 = s.replaceAll("[/]{2,}", "/");

        String s2 = s1;

        if(s1.length()>1){
            s2 = s1.substring(0,s1.length()-1);
        }


        return s2;

    }
}
